<template>
  <div class="nav">
    <div class="logo">
      <img src="../assets/signin/scut.png" class="img"/>
      <!-- <img src="../assets/signin/scut.png" class="img" />
      <img src="../assets/signin/sysu.png" class="img" />
      <img src="../assets/signin/cuhk.png" class="img" />
      <img src="../assets/signin/cma.png" class="img" />
      <img src="../assets/signin/gdms.png" class="img" /> -->
      <strong style="display: block; text-align: center; font-size: 27px; color:aliceblue"
        >  华南理工大学</strong
      >
    </div>
    <div class="nav-menu" v-if="this.$store.state.isLogin">

      <div class="nav-user" style="margin-left: 80%">
        <div class="avatar">
          <img class="avatar-img" src="../assets/User.png"/>
        </div>
        <p class="nav-uid" >{{ this.$store.state.userinfo.uid }}</p>
        <el-menu
                :default-active="activeindex"
                :ellipsis="false"
                text-color="white"
                mode="horizontal"
                background-color="transparent"
                style="display: flex;"
        >
          <el-menu-item index="predict" @click="toPredict()">退出登录</el-menu-item>

        </el-menu>

      </div>
    </div>
    <!-- <el-button @click="toMy()">User</el-button> -->
  </div>
</template>

<script>
export default {
  name: "Navbar",
  mounted() {
    setTimeout(() => {
      console.log(this.$route.fullPath)
      this.activeindex = this.$route.fullPath.substring(1)
    }, 0)
  },
  data() {
    return {
      activeindex: "predict",
    };
  },
  methods: {
    handleselect(e) {
      console.log(e);
    },
    toMy() {
      this.activeindex = "my";
      this.$router.push({
        path: "/my",
      });
    },
    toWind() {
      this.activeindex = "wind";
      this.$router.push({
        path: "/wind",
      });
    },
    toNino() {
      this.activeindex = "nino";
      this.$router.push({
        path: "/nino",
      });
    },
    toPredict() {
      this.activeindex = "predict";
      this.$router.push({
        path: "/",
      });
    },
    toWaterPredict() {
      this.activeindex = "water";
      this.$router.push({
        path: "/water",
      });
    },
    togd() {
      this.activeindex = "gd";
      this.$router.push({
        path: "/gd",
      });
    },
    toRadar() {
      this.activeindex = "rainfall";
      this.$router.push({
        path: "/rainfallP",
      });
    },
    toRainfall() {
      this.activeindex = "rainfall";
      this.$router.push({
        path: "/rainfall",
      });
    },

    toDbz() {
      this.activeindex = "dbz";
      this.$router.push({
        path: "/radar",
      });
    },
    toDbzp() {
      this.activeindex = "dbzp";
      this.$router.push({
        path: "/DBZP",
      });
    },

    Loginout() {
      this.$store.commit("Loginout");
      this.$router.push({
        path: "/",
      });
    },
    toTyphoon() {
      // window.location.href = "http://47.112.166.50:7755/"
      window.open("http://47.112.166.50:7755/", "_blank");
    }
  },

};
</script>

<style lang="css" scoped>
strong {
  margin-left: 20px; /* 或者您想要的像素值 */
}

.img {
  transform: scale(1.5); 
  margin-left: 10px;
}

.nav {
  background: linear-gradient(to right, #99ccff, #ccffff);
  width: auto;
  border-radius: 10px;
  height: 80px;
  /* height: 4vw; */
  flex-direction: row;
  display: flex;
  flex: 1;
  align-items: center;
  /* justify-content: space-between; */
}

h3 {
  color: #ffffff;
  font-size: 1vw;
  width: 11vw;
  margin-right: 1vw;
}

.logo {
  height: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
}

.img {
  /* 设置图像的高度为90% */
  height: 70%;
  transform: scale(1.5);
  margin-left: 10px;
}
.userButton {
  color: skyblue;
}

.nav-menu {
  display: flex;
  flex-direction: row;
  width: 80vw;
}

.el-menu .el-menu-item {
  flex: 1;
  font-size: 1vw;
  font-weight: bold;
  color: white;
  width: 9vw;

}

.nav-user {
  display: flex;
  flex-direction: row;
  align-items: center;
  width: 35vw;
  /* height: 4vw; */
}

.nav-uid {
  margin: 0px 10px;
  color: gray;
  font-weight: bold;
  font-size: 1vw;
  width: 3vw;
  padding-right: 2vw;
}

.avatar {
  border-radius: 50%;
  overflow: hidden;
  object-fit: cover;
  /* height: 64px; */
  position: relative;
  display: flex;
  justify-content: center;
  width: 3vw;
  height: 3vw;
}

#btn {
  align-self: center;
  background: linear-gradient(to right, #8bbbed, #e8f4ff);
  border-radius: 5px;
  box-shadow: 0 0 5px rgba(18, 27, 89, 0.5);
  border: none;
  cursor: pointer;
  margin-right: 10px;
  color: black;
  display: flex;
  /* color: white; */
  width: 14vw;
}

#btn:hover {
  background: linear-gradient(to left, #8bbbed, #e8f4ff);
}
</style>
